package com.gg.hc.controller;

import com.gg.common.pojo.MDesignProcedure;
import com.gg.common.pojo.MDesignProcedureDetails;
import com.gg.hc.search.MDesignProcedure_detailsVo;
import com.gg.hc.service.MDesignProcedureDetailsService;
import com.gg.hc.service.MDesignProcedureService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class MDesignProcedureDetailsController {
    @Resource
    private MDesignProcedureDetailsService mDesignProcedureDetailsService;
    @Resource
    private MDesignProcedureService mDesignProcedureService;

    @ResponseBody
    @RequestMapping("/BatchUpdateDesignProcedureProcess.action")
    public int BatchUpdateDesignProcedureProcess(@RequestBody MDesignProcedure_detailsVo result){
        System.out.println("进来了"+result);
        mDesignProcedureService.UpdateCheckTag(result.getMDesignProcedure());
        return mDesignProcedureDetailsService.BatchUpdateDesignProcedureProcess(result.getMDesignProcedureDetails());
    }

    @ResponseBody
    @RequestMapping("/DeleteMDesignProcedure.action")
    public int DeleteMDesignProcedure(Integer id){
        return mDesignProcedureDetailsService.deleteByPrimaryKey(id);
    }

    @ResponseBody
    @RequestMapping("/AddMDesignProcedureProcess.action")
    public int AddMDesignProcedureProcess(@RequestBody MDesignProcedureDetails mDesignProcedureDetails){
        System.out.println("进来了");
       return mDesignProcedureDetailsService.AddMDesignProcedureProcess(mDesignProcedureDetails);
    }

    @ResponseBody
    @RequestMapping("/AddMDesignProcedureDetails.action")
    public int AddMDesignProcedureDetails(@RequestBody List<MDesignProcedureDetails> mDesignProcedureDetails){
       return mDesignProcedureDetailsService.insert(mDesignProcedureDetails);
    }
    @ResponseBody
    @RequestMapping("/queryMDesignProcedureDetailsByParentId.action")
    public List<MDesignProcedureDetails> queryMDesignProcedureDetailsByParentId(Integer id){
        return mDesignProcedureDetailsService.queryMDesignProcedureDetailsByParentId(id);
    }
    @ResponseBody
    @RequestMapping("/selectByPrimaryKey.action")
    public MDesignProcedureDetails selectByPrimaryKey(Integer id){
        return mDesignProcedureDetailsService.selectByPrimaryKey(id);
    }
    @ResponseBody
    @RequestMapping("/updateMDesignProcedureDetailsTagById.action")
    public int updateMDesignProcedureDetailsTagById(Integer id){
        return mDesignProcedureDetailsService.updateMDesignProcedureDetailsTagById(id);
    }
    @ResponseBody
    @RequestMapping("/updateMDesignProcedureDetailsModuleSubtotal.action")
    public int updateMDesignProcedureDetailsModuleSubtotal(@RequestBody MDesignProcedureDetails mDesignProcedureDetails){
        return mDesignProcedureDetailsService.updateMDesignProcedureDetailsModuleSubtotal(mDesignProcedureDetails);
    }
    @ResponseBody
    @RequestMapping("/queryMDesignProcedureDetailsById.action")
    public List<MDesignProcedureDetails> updateMDesignProcedureDetailsModuleSubtotal(@RequestBody List<MDesignProcedureDetails> mDesignProcedureDetailsList){
        System.out.println("进来了");
        System.out.println(mDesignProcedureDetailsList);
        return mDesignProcedureDetailsService.queryMDesignProcedureDetailsById(mDesignProcedureDetailsList);
    }

}
